/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Sjakk;

/**
 *
 * @author Jørn // Vegard
 */
import java.io.*;

public class SaveLoad implements Serializable {
    public void save(String filnavn, Brett brett) throws Exception {
        FileOutputStream utstrøm = new FileOutputStream(filnavn);
        ObjectOutputStream ut = new ObjectOutputStream(utstrøm);
        ut.writeObject(brett);
        ut.close();
    }

    public Brikke[][] load(String filnavn) throws Exception {
        FileInputStream innstrøm = new FileInputStream(filnavn);
        ObjectInputStream inn = new ObjectInputStream(innstrøm);
        Brett innBrett = (Brett)inn.readObject();
        inn.close();
        return innBrett.getBrett();
    }
}
